package cn.fancy.sdk;

import android.os.Handler;
import android.os.Message;
import java.util.Map;

import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import cn.fancy.sdk.entity.GuildBaseInfo;
import cn.fancy.sdk.login.utils.HttpReq;

public class RoleStatis {
    
    public static final String AC_CREATE_ROLE = "roleCreate";
    public static final String AC_ROLE_LEVEL_UP = "roleLevelUp";
    public static final String AC_USER_PAY = "user_pay";
    public static final String AC_ENTER_GAME = "enter";
    
    private static final int REQ_TIME = 10088;
    
    
    static void sendStatis(final Context context, final Bundle bundle) {
        
        final Handler reqHandler = new Handler() {
            @Override
            public void handleMessage(Message msg) {
                switch (msg.what) {
                    case REQ_TIME: {
                        final Map<String, String> map = GuildBaseInfo.getInstance()
                            .getStatisParamGuild(context, bundle, "get_role_sdk");
                        
                        Thread thread = new Thread(new Runnable() {
                            
                            @Override
                            public void run() {
                                String rst = HttpReq.doGuildRequest(map);
                                Log.d("doRoleStatisRequestmap", map.toString());
                                Log.d("doRoleStatisRequestrst", rst);
                            }
                        });
                        
                        thread.start();
                    }
                    break;
                }
            }
        };
        
        new Thread() {
            @Override
            public void run() {
                String netTime = GuildBaseInfo.getTime(context);
                Message msg = new Message();
                msg.obj = netTime;
                msg.what = REQ_TIME;
                reqHandler.sendMessage(msg);
            }
        }.start();
        
        
    }
}